<template>
  <li class="article-item">
    <div class="content">
      <router-link class="title" v-bind:to="target"
        ><span
          class="article-type article-type-reprint"
          v-if="item.fromType == 1"
          >转载</span
        >
        <span class="article-type article-type-origin" v-if="item.fromType == 0"
          >原创</span
        >{{ item.title }}</router-link
      >
      <p class="abstract">{{ item.description }}</p>
      <div class="meta">
        <span class="date">{{ item.createTime }}</span>
        <span class="jsd-meta">
          <i class="iconfont ic-paid1"></i> {{ item.classify.name }}
        </span>
        <a class="nickname" href="javascript:void(0);">凉二爸爸</a>
        <span><i class="el-icon-view"></i> {{ item.readNum }}</span>
        <a href="javascript:void(0);">
          <i class="el-icon-chat-square"></i> {{ item.commentNum }}
        </a>
      </div>
    </div>
  </li>
</template>
<script>
export default {
  name: "ArticleListItem",
  props: { item: Object },
  computed: {
    target: function () {
      return { path: "article/" + this.item.id };
    },
  },
};
</script>
<style scoped>
li {
  position: relative;
  margin: 0 0 15px;
  padding: 15px 4px 20px 10px;
  border-bottom: 1px solid #c0c4cc;
  word-wrap: break-word;
  line-height: 20px;
}
.title:visited {
  color: #969696;
}
.title {
  margin: -7px 0 4px;
  display: inherit;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
  color: #333;
}
.abstract {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 24px;
  color: #999;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-height: 48px;
}
.meta {
  padding-right: 0 !important;
  font-size: 12px;
  font-weight: 400;
  line-height: 20px;
}
.meta span {
  margin-right: 10px;
  color: #b4b4b4;
}
.meta a {
  margin-right: 10px;
  color: #b4b4b4;
}
.jsd-meta {
  color: #ea6f5a !important;
}
.article-type {
  margin-right: 10px;
  vertical-align: 2px;
  display: inline-block;
  box-sizing: border-box;
  width: 34px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  font-size: 12px;
  border-radius: 2px;
  float: none;
}
.article-type-reprint {
  color: #67bb55;
  background-color: rgba(103, 187, 85, 0.1);
}
.article-type-origin {
  color: #fc5531;
  background-color: #fff5f2;
}
</style>